package com.lzx.iteam;


import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.GridView;
import android.widget.TextView;
import com.lzx.iteam.adapter.FolderAdapter;
import com.lzx.iteam.selectimage.*;

import java.util.List;

/**
 * 这个类主要是用来进行显示包含图片的文件夹
 *
 * @author king
 * @QQ:595163260
 * @version 2014年10月18日  下午11:48:06
 */
public class ImageFileActivity extends Activity {

	private FolderAdapter folderAdapter;
	private TextView bt_cancel;
	private Context mContext;
	private AlbumHelper helper;
	public static List<ImageBucket> contentList;
	public static ImageFileActivity instance = null;

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(Res.getLayoutID("plugin_camera_image_file"));
		//PublicWay.activityList.add(this);
		mContext = this;
		instance = this;
		bt_cancel = (TextView) findViewById(Res.getWidgetID("cancel"));
		bt_cancel.setOnClickListener(new CancelListener());
		GridView gridView = (GridView) findViewById(Res.getWidgetID("fileGridView"));
		TextView textView = (TextView) findViewById(Res.getWidgetID("headerTitle"));
		textView.setText(Res.getString("photo"));

		helper = AlbumHelper.getHelper();
		//helper.init(getApplicationContext());
		helper.init(this);

		contentList = helper.getImagesBucketList(false);
		int imageNumber = getIntent().getIntExtra("image_number",9);
		folderAdapter = new FolderAdapter(this,imageNumber);
		gridView.setAdapter(folderAdapter);

	}

	private class CancelListener implements OnClickListener {// 取消按钮的监听
		public void onClick(View v) {
			//清空选择的图片
			Bimp.tempSelectBitmap.clear();
			finish();
		}
	}


}
